package com.fhs.demo.controller;

import com.fhs.demo.entity.Student;
import com.fhs.demo.entity.Student1;
import com.fhs.demo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping(value = "/easy-trans")
public class TransController {

    @Autowired
    private StudentService studentService;

    @GetMapping(value = "getStudent")
    public Student test(){
        Student student = studentService.getStudent();
        return student;
    }

    @GetMapping(value = "getStudent1")
    public Student1 test1(){
        Student1 student = studentService.getStudent1();
        return student;
    }


    @GetMapping(value = "student1/list")
    public List<Student1> testlist(){
        Student1 student1 = studentService.getStudent1();
        Student1 student2 = studentService.getStudent1();
        student2.setUserId3("2");
        student2.setUserId("2");
        student2.setIdNo1("4861562");
        List<Student1> list = new ArrayList<>();
        list.add(student1);
        list.add(student2);
        return list;
    }
}
